/* 绩效-基础设置-考核模板库api */
import { ajaxService } from '@/utils/request';
import { ajaxUploadService } from '@/utils/requestUpload';
import * as typeObj from './type';

const env = import.meta.env;
// let baseURL = env.VITE_API_BASE_URL;
// const baseURL = 'http://192.168.31.129:39001';
// const baseURL = 'http://192.168.31.129:39001';
// const baseURL = env.VITE_APP_BASE_URL;
// const baseURL = env.VITE_APP_BASE_URL;
// const baseURL = 'http://192.168.31.129:39001';
const baseURL = env.VITE_DEV_BASE_URL;

// 获取用期考核模板列表
export function GetProbationTemplate(params: any) {
  return ajaxService({
    url: '/pl/performance/probation/template',
    method: 'get',
    baseURL: baseURL,
    params
  });
}

// 删除用期考核模板列表
export function DelProbationTemplate(data: any) {
  return ajaxService({
    url: '/pl/performance/probation/template',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}

// 新增试用期考核模板
export function PostProbationTemplate(data: any) {
  return ajaxService({
    url: '/pl/performance/probation/template',
    method: 'post',
    baseURL: baseURL,
    data
  });
}

// 获取用期考核模板详情
export function GetProbationTemplateDetail(params: any) {
  return ajaxService({
    url: '/pl/performance/probation/templateDetails',
    method: 'get',
    baseURL: baseURL,
    params
  });
}

// 删除期考核模板考核工具
export function DelProbationTemplateDimension(params: any) {
  return ajaxService({
    url: '/pl/performance/probation/template/dimension',
    method: 'delete',
    baseURL: baseURL,
    params
  });
}

// 试用期考核模板编辑考核指标删除
export function DelProbationTemplateTool(params: any) {
  return ajaxService({
    url: '/pl/performance/probation/template/tool',
    method: 'delete',
    baseURL: baseURL,
    params
  });
}

// 修改试用期考核模板基础信息
export function PutProbationTemplateBaseInfo(data: any) {
  return ajaxService({
    url: '/pl/performance/probation/template',
    method: 'put',
    baseURL: baseURL,
    data
  });
}

/**
 * 获取工作计划指标库列表
 * @param params
 * @returns
 */
export function GetPpiIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/work_plan_index_library/index/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：工作计划指标库
 * @param params
 * @returns
 */
export function GetPpiIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/work_plan_index_library/index/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增工作计划指标库
 * @param data
 * @returns
 */
export function PostPpiIndex(data: typeObj.PpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/work_plan_index_library/index/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改工作计划指标库
 * @param data
 * @returns
 */
export function PutPpiIndex(data: typeObj.PpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/work_plan_index_library/index/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除工作计划指标库
 * @param data
 * @returns
 */
export function DelPpiIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/work_plan_index_library/index/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}

/**
 * 获取否决指标库列表
 * @param params
 * @returns
 */
export function GetVetolIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/veto_index_library/index/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：否决指标库
 * @param params
 * @returns
 */
export function GetVetolIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/veto_index_library/index/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增否决指标库
 * @param data
 * @returns
 */
export function PostVetolIndex(data: typeObj.VetoIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/veto_index_library/index/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改否决指标库
 * @param data
 * @returns
 */
export function PutVetolIndex(data: typeObj.VetoIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/veto_index_library/index/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除否决指标库
 * @param data
 * @returns
 */
export function DelVetolIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/veto_index_library/index/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
/**
 * 获取加减分项指标库列表
 * @param params
 * @returns
 */
export function GetScoreCalculationIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/add_subtract_index_library/index/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：加减分项指标库
 * @param params
 * @returns
 */
export function GetScoreCalculationIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/add_subtract_index_library/index/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增加减分项指标库
 * @param data
 * @returns
 */
export function PostScoreCalculationIndex(data: typeObj.ScoreCalculationIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/add_subtract_index_library/index/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改加减分项指标库
 * @param data
 * @returns
 */
export function PutScoreCalculationIndex(data: typeObj.ScoreCalculationIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/add_subtract_index_library/index/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除加减分项指标库
 * @param data
 * @returns
 */
export function DelScoreCalculationIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/add_subtract_index_library/index/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
/**
 * 获取目标与关键成果指标库列表
 * @param params
 * @returns
 */
export function GetOkrIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/target_index_library/target/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：目标与关键成果指标库
 * @param params
 * @returns
 */
export function GetOkrIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/target_index_library/target/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增目标与关键成果指标库
 * @param data
 * @returns
 */
export function PostOkrIndex(data: typeObj.OkrIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/target_index_library/target/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改目标与关键成果指标库
 * @param data
 * @returns
 */
export function PutOkrIndex(data: typeObj.OkrIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/target_index_library/target/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除目标与关键成果指标库
 * @param data
 * @returns
 */
export function DelOkrIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/target_index_library/target/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
/**
 * 获取能力素质指标库列表
 * @param params
 * @returns
 */
export function GetBpiIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/ability_quality_index_library/index/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：能力素质指标库
 * @param params
 * @returns
 */
export function GetBpiIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/ability_quality_index_library/index/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增能力素质指标库
 * @param data
 * @returns
 */
export function PostBpiIndex(data: typeObj.BpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/ability_quality_index_library/index/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改能力素质指标库
 * @param data
 * @returns
 */
export function PutBpiIndex(data: typeObj.BpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/ability_quality_index_library/index/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除能力素质指标库
 * @param data
 * @returns
 */
export function DelBpiIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/ability_quality_index_library/index/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
/**
 * 获取关键业绩指标库列表
 * @param params
 * @returns
 */
export function GetKpiIndexList(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/key_performance_index_library/performance/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：关键业绩指标库
 * @param params
 * @returns
 */
export function GetKpiIndexRepeat(params: { name?: string }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/key_performance_index_library/performance/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增关键业绩指标库
 * @param data
 * @returns
 */
export function PostKpiIndex(data: typeObj.KpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/key_performance_index_library/performance/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改关键业绩指标库
 * @param data
 * @returns
 */
export function PutKpiIndex(data: typeObj.KpiIndex) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/key_performance_index_library/performance/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除关键业绩指标库
 * @param data
 * @returns
 */
export function DelKpiIndex(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/index_library/key_performance_index_library/performance/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
/**
 * 获取绩效考核模板列表
 * @param params 模板类型（1、绩效考核模板2、试用期考核模板3、晋升考核模板4、任期考核模板5、合同续签考核模板6、其他考核模板）
 * @returns
 */
export function GetPerformanceAppraisalTemplate(params: {
  templateType: number;
}) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/list',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 获取绩效考核模板详情
 * @param params
 * @returns
 */
export function GetPerformanceAppraisalTemplateDetails(params: { id: number }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/info',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 查重：绩效考核模板
 * @param params
 * @returns
 */
export function GetPerformanceAppraisalTemplateRepeat(params: {
  name?: string;
}) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/repeat',
    method: 'get',
    baseURL: baseURL,
    params
  });
}
/**
 * 新增绩效考核模板
 * @param data
 * @returns
 */
export function PostPerformanceAppraisalTemplate(
  data: typeObj.PerformanceAppraisal
) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/add',
    method: 'post',
    baseURL: baseURL,
    data
  });
}
/**
 * 修改绩效考核模板
 * @param data
 * @returns
 */
export function PutPerformanceAppraisalTemplate(
  data: typeObj.PerformanceAppraisal
) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/update',
    method: 'put',
    baseURL: baseURL,
    data
  });
}
/**
 * 删除绩效考核模板
 * @param data
 * @returns
 */
export function DelPerformanceAppraisalTemplate(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/performance/basic_setting/assessment_template_library/assessment_template/template/delete',
    method: 'delete',
    baseURL: baseURL,
    data
  });
}
